package com.jack.mvvmexample.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

abstract class BaseActivity<DB : ViewDataBinding> : AppCompatActivity(){

    protected lateinit var vdb : ViewDataBinding

    override final fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        vdb =  DataBindingUtil.setContentView<DB>(this,getLayoutId())
        vdb.lifecycleOwner = this
    }

    open abstract fun getLayoutId() : Int
}